import socket
#1.创建socket对象
client_socket=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
#2.发送数据
while True:
    #3.发送数据
    data_client=input('客户说：')
    ip_port=('127.0.0.1',8888)
    #print(data_client)
    client_socket.sendto(data_client.encode('utf-8'),ip_port)
    if data_client=='bye':
        break
    #4.接收数据
    data2,addr=client_socket.recvfrom(1024)
    print('客服说：',data2.decode('utf-8'))
#5.关闭socket对象
client_socket.close()